﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;
using Web.Old_App_Code;



public partial class code : System.Web.UI.Page
{
    
    // Fields
    protected Color backgroundColor = Color.White;
    protected bool chaos = true;
    protected Color chaosColor = Color.Pink;
    protected string codeSerial = "2,3,4,6,7,8,9,a,b,c,d,e,f,g,h,j,k,m,n,p,q,r,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,T,U,V,W,X,Y,Z";
    protected Color[] colors = new Color[] { Color.Black, Color.Red, Color.DarkBlue, Color.Green, Color.Orange, Color.Brown, Color.DarkCyan, Color.Purple };
    protected string[] fonts = new string[] { "Arial", "Georgia" };
    protected int fontSize = 14;
    protected int length = 4;
    protected int padding = 1;

    // Methods
    private void Page_Load(object sender, EventArgs e)
    {
        VerifyCode code = new VerifyCode();
        code.Length = this.length;
        code.FontSize = this.fontSize;
        code.Chaos = this.chaos;
        code.BackgroundColor = this.backgroundColor;
        code.ChaosColor = this.chaosColor;
        code.CodeSerial = this.codeSerial;
        code.Colors = this.colors;
        code.Fonts = this.fonts;
        code.Padding = this.padding;
        string str = code.CreateVerifyCode();
        code.CreateImageOnPage(str, this.Context);
        if (base.Request.QueryString["t"] == "conmment")
        {
            this.Session["tCheckCode"] = str.ToLower();
        }
        else if (base.Request.QueryString["t"] == "memberLogin")
        {
            this.Session["mlCheckCode"] = str.ToLower();
        }
        else if (base.Request.QueryString["t"] == "register")
        {
            this.Session["rCheckCode"] = str.ToLower();
        }
        else if (base.Request.QueryString["t"] == "adminLogin")
        {
            this.Session["alCheckCode"] = str.ToLower();
        }
        else if (base.Request.QueryString["t"] == "onlineMessage")
        {
            this.Session["omCheckCode"] = str.ToLower();
        }
    }

}